/*
 * Copyright (c) 2010 Mathew Hall, University of Sheffield.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or
 * without modification, are permitted provided that the following conditions
 * are met:
 *
 * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *
 * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following
 * disclaimer in the documentation and/or other materials provided
 * with the distribution.
 *
 * Neither the name of the University of Sheffield nor the names of its
 * contributors may be used to endorse or promote products derived
 * from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */
package primitives.cluster;

import primitives.cluster.ClusterLeaf;
import java.util.List;
import java.util.Set;
import primitives.graph.Node;

public interface IClusterLevel {

	public void setID(int id);
	public boolean knownAs(int id);
	
	public Set<Integer> getIDs();
	

	/**
	 * Determine if this ClusterLevel contains multiple clusters.
	 * This function returns true if the node it is called on is actually
	 * a summation of subclusters and false if it is just a single tangible cluster.
	 * It may be viewed as an inversion of the predicate that the object is a leaf.
	 * i.e. !(leaf(thisNode))
	 * @return true if the node is a collection of clusters and false otherwise.
	 */
	public boolean encapsulates();
	
	public IClusterLevel deepCopy();
	
	public int getSize();
	
	public void addNode(Node n);
	
	
	public List<ClusterLeaf> getLeaves();

	/**
	 * Get all nodes below the ClusterLevel.
	 * @param to a set that will be filled with nodes as the method recurses.
	 */	
	public void getNodes(Set<Node> to);
	
	/**
	 * Get all nodes below the ClusterLevel.
	 * @return a set of nodes.
	 */
	public Set<Node> getNodes();
	
	/**
	 * Searches the ClusterLevels below this node for node n.
	 * @return true if n is contained in any of the ClusterLevels below this node, false otherwise.
	 */
	public boolean contains(Node n);
	
	/**
	 * Determines if a node x in this cluster exists such that x -> n
	 * @param n the node to search for connectivity to
	 * @return true if there is an edge between a node in this cluster and the parameter
	 */
	public boolean connectivityTo(Node n);
	
	/**
	 * Determines if a node x in this cluster exists such that n -> x
	 * @param n the node to search for connectivity from
	 * @return true if there is an edge between the parameter and this cluster
	 */
	public boolean connectivityFrom(Node n);
	/**
	 * Determines if a node has a transition between this cluster in either direction.
	 * @param n the node to search for connectivity with
	 * @return true if there is an edge between this cluster and the parameter.
	 */
	public boolean connectivityBidir(Node n);
	
	public ClusterLeaf getCluster(); //return a cluster representation of the node
}
